{if $useAjax}
<script type="text/javascript">
{literal}
function submitComment()
{
	if (typeof(updateAd) != 'undefined')
	{
		updateAd();
	}
	sId('comment_submit_button').disabled=true;
	if ( typeof(tinyMCE) != 'undefined' )
	{
		tinyMCE.triggerSave(false, false);
		tinyMCE.execCommand('mceSetContent',false, '');
	}
	new Effect.Appear('ajax_main_image_cm');
	xajax_newComment(xajax.getFormValues("commentForm"));
	if ( typeof(tinyMCE) == 'undefined' )
	{
		sId('maintext').value='';		
	}
	return false;
}
{/literal}
</script>
{/if}
<div>
{if $bLogged}
{messages block='add-comment' error_var='aErrors2'}
{if $sCommentType == 'account'}
{if !$useAjax}
<form method="post" action="{url link='current' type=$sCommentType cid=$mId}">
<div><input type="hidden" name="val[alert_id]" value="{$iAlertId}" /></div>
{else}
<form id="commentForm" method="post" action="javascript:void(null);" onsubmit="submitComment();">
<div><input type="hidden" name="alert_id" value="{$iAlertId}" /></div>
<div><input type="hidden" name="ajax_isuser" value="{$isuser}" /></div>
<div><input type="hidden" name="ajax_id" value="{$mId}" /></div>
<div><input type="hidden" name="ajax_type" value="{$sCommentType}" /></div>
<div class="ajax_message" id="ajax_main_image_cm" style="display:none; font-size:10pt; font-weight:bold;">
	<img src="design/pic/loader.gif" alt="" style="vertical-align:middle;" /> <span id="ajax_comment_info">{language text="comment.being.added"}</span>
</div>
{/if}
<div id="ajax_main_form" style="font-size:10pt;">
	<div style="padding:6px;"><b>{language text="leave_me_a_comment"}</b></div>
	<div><textarea cols="60" rows="10" name="val[text]" style="width:90%;" id="maintext" onfocus="this.style.backgroundColor='#fff';" onblur="this.style.backgroundColor='#F6F6F6';">{$aValues.text}</textarea></div>
	<div style="padding:6px;">
		<div>
			{include file="$sMainTemplatePath/_blocks/smilies.html"}			
		</div>
		<div style="padding:5px; text-align:center; margin-top:8px;">
			<input id="comment_submit_button" type="submit" name="act[comment]" value="{language text='submit_comment'}" class="mainmenu6" onmouseover="this.className='mainmenu7';" onmouseout="this.className='mainmenu6';" onclick="if (document.getElementById('formhide1')) {literal}{{/literal} document.getElementById('formhide1').style.display='none';document.getElementById('formhide2').style.display=''; {literal}}{/literal}" />
		</div>
	</div>
</div>

</form>
{else}

{if !$useAjax }
<form method="post" action="{url link='current' type=$sCommentType cid=$mId}" style="margin:0px;">
<div><input type="hidden" name="val[alert_id]" value="{$iAlertId}" /></div>
{else}
<form id="commentForm" method="post" action="javascript:void(null);" onsubmit="submitComment();">
<div><input type="hidden" name="alert_id" value="{$iAlertId}" /></div>
<div><input type="hidden" name="ajax_id" value="{$mId}" /></div>
<div><input type="hidden" name="ajax_type" value="{$sCommentType}" /></div>
<div class="ajax_message" id="ajax_main_image_cm" style="display:none; font-size:10pt; font-weight:bold;">
	<img src="design/pic/loader.gif" alt="" style="vertical-align:middle;" /> <span id="ajax_comment_info">{language text="comment.being.added"}</span>
</div>
{/if}
<div id="ajax_main_form" style="font-size:10pt;">
	<div style="padding-bottom:4px;"><b><label for="maintext">{language text="your_comment"}:</label></b></div>
	<div><textarea cols="60" rows="10" style="width:90%;" name="val[text]" id="maintext" onfocus="this.style.backgroundColor='#fff';" onblur="this.style.backgroundColor='#F6F6F6';">{$aValues.text}</textarea></div>
	<div style="padding-top:4px;">
		<div>
			{include file="$sMainTemplatePath/_blocks/smilies.html"}			
		</div>
		<input id="comment_submit_button" type="submit" name="act[comment]" value="{language text='submit_comment'}" class="mainmenu6" onmouseover="this.className='mainmenu7';" onmouseout="this.className='mainmenu6';" onclick="if (document.getElementById('formhide1')) {literal}{{/literal} document.getElementById('formhide1').style.display='none';document.getElementById('formhide2').style.display=''; {literal}}{/literal}" />
	</div>
</div>
</form>
<br />
{/if}
{else}
<div style="font-size:10pt;">
	<a class="link_action" href="{url link='public.login'}">[ {language text="login_to_post_a_comment"} ]</a>
</div>
{/if}
</div>